/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javalens.astronomy;

import javalens.util.Util;

/**
 *
 * @author vermaak
 */
public class Event {

    private double b = Double.NaN;
    private double te = Double.NaN;
    private double tm = Double.NaN;
    private double m0 = Double.NaN;
    private double f = 1.0;
    private double rs = 0.0;
    private double rho = 0.0;
    private double psi = 0.0;
    private double ang = 0.0;
    private double a = 0.0;
    private double q = 0.0;

    public Event(double b, double te, double tm, double m0) {
        this.b = b;
        this.te = te;
        this.tm = tm;
        this.m0 = m0;
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        Event ret = new Event(b, te, tm, m0);
        ret.a = a;
        ret.ang = ang;
        ret.f = f;
        ret.psi = psi;
        ret.q = q;
        ret.rho = rho;
        ret.rs = rs;
        return ret;
    }

    public boolean isSingleLens() {
        return (Util.equals(q, 0.0) || Util.equals(a, 0.0));
    }

    public double getA() {
        return a;
    }

    public void setA(double a) {
        this.a = a;
    }

    public double getQ() {
        return q;
    }

    public void setQ(double q) {
        this.q = q;
    }

    public double getAng() {
        return ang;
    }

    public void setAng(double ang) {
        this.ang = ang;
    }

    public double getPsi() {
        return psi;
    }

    public void setPsi(double psi) {
        this.psi = psi;
    }

    public double getRho() {
        return rho;
    }

    public void setRho(double rho) {
        this.rho = rho;
    }

    public double getF() {
        return f;
    }

    public void setF(double f) {
        this.f = f;
    }

    public double getRs() {
        return rs;
    }

    public void setRs(double rs) {
        this.rs = rs;
    }

    public double getB() {
        return b;
    }

    public void setB(double b) {
        this.b = b;
    }

    public double getM0() {
        return m0;
    }

    public void setM0(double m0) {
        this.m0 = m0;
    }

    public double getTe() {
        return te;
    }

    public void setTe(double te) {
        this.te = te;
    }

    public double getTm() {
        return tm;
    }

    public void setTm(double tm) {
        this.tm = tm;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Event other = (Event) obj;
        if (this.b != other.b) {
            return false;
        }
        if (this.te != other.te) {
            return false;
        }
        if (this.tm != other.tm) {
            return false;
        }
        if (this.m0 != other.m0) {
            return false;
        }
        if (this.f != other.f) {
            return false;
        }
        if (this.rs != other.rs) {
            return false;
        }
        if (this.rho != other.rho) {
            return false;
        }
        if (this.psi != other.psi) {
            return false;
        }
        if (this.ang != other.ang) {
            return false;
        }
        if (this.a != other.a) {
            return false;
        }
        if (this.q != other.q) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 61 * hash + (int) (Double.doubleToLongBits(this.b) ^ (Double.doubleToLongBits(this.b) >>> 32));
        hash = 61 * hash + (int) (Double.doubleToLongBits(this.te) ^ (Double.doubleToLongBits(this.te) >>> 32));
        hash = 61 * hash + (int) (Double.doubleToLongBits(this.tm) ^ (Double.doubleToLongBits(this.tm) >>> 32));
        hash = 61 * hash + (int) (Double.doubleToLongBits(this.m0) ^ (Double.doubleToLongBits(this.m0) >>> 32));
        hash = 61 * hash + (int) (Double.doubleToLongBits(this.f) ^ (Double.doubleToLongBits(this.f) >>> 32));
        hash = 61 * hash + (int) (Double.doubleToLongBits(this.rs) ^ (Double.doubleToLongBits(this.rs) >>> 32));
        hash = 61 * hash + (int) (Double.doubleToLongBits(this.rho) ^ (Double.doubleToLongBits(this.rho) >>> 32));
        hash = 61 * hash + (int) (Double.doubleToLongBits(this.psi) ^ (Double.doubleToLongBits(this.psi) >>> 32));
        hash = 61 * hash + (int) (Double.doubleToLongBits(this.ang) ^ (Double.doubleToLongBits(this.ang) >>> 32));
        hash = 61 * hash + (int) (Double.doubleToLongBits(this.a) ^ (Double.doubleToLongBits(this.a) >>> 32));
        hash = 61 * hash + (int) (Double.doubleToLongBits(this.q) ^ (Double.doubleToLongBits(this.q) >>> 32));
        return hash;
    }

    public String[] getHeaders() {
        return new String[]{"a", "ang", "b", "f", "m0", "q", "te", "tm"};
    }

    public double[] getValues() {
        return new double[]{a, ang, b, f, m0, q, te, tm};
    }
}
